#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtWidgets/QMainWindow>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QTableWidget>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QMenuBar>
#include <QtWidgets/QToolBar>
#include <QtWidgets/QStatusBar>
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QLabel>
#include <QtWidgets/QProgressBar>
#include <QtGui/QAction>
#include <QtGui/QIcon>
#include <QtCore/QTimer>
#include <QtCore/QList>

class DownloadManager;
class DownloadItem;
class SettingsManager;
class SettingsDialog;
class DownloadHistory;
class NotificationManager;

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void addDownload();
    void startDownload();
    void pauseDownload();
    void removeDownload();
    void showDownloadProperties();
    void openSettings();
    void updateDownloadProgress(DownloadItem *item);
    void onDownloadFinished();
    void onDownloadError(const QString &errorString);

private:
    void setupUI();
    void setupMenu();
    void setupToolbar();
    void setupTable();
    void setupStatusBar();
    void updateTableItem(int row, DownloadItem *item);

    // UI组件
    QToolBar *m_toolbar;
    QTableWidget *m_downloadTable;
    
    // 状态栏
    QLabel *m_statusLabel;
    QProgressBar *m_statusProgressBar;
    
    // 核心组件
    DownloadManager *m_downloadManager;
    SettingsManager *m_settingsManager;
    SettingsDialog *m_settingsDialog;
    DownloadHistory *m_downloadHistory;
    NotificationManager *m_notificationManager;
};

#endif // MAINWINDOW_H